package com.brucekong.slm.controller.workorder;

import com.brucekong.slm.common.Result;
import com.brucekong.slm.model.system.SystemDomain;
import com.brucekong.slm.model.workorder.WorkOrderDomain;
import com.brucekong.slm.service.system.SystemService;
import com.brucekong.slm.service.workorder.WorkOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 工作流控制类
 */
@RestController
@RequestMapping("/workorder")
@Slf4j
@Api(value = "系统模块", tags = "系统模块")
public class WorkOrderController {

    private Result result = new Result();

    @Autowired
    private WorkOrderService workOrderService;

    /**
     * 获取工单列表
     *
     * @return resultList 工单列表
     */
    @GetMapping("/list")
    @SuppressWarnings("unchecked")
    @ApiOperation(value = "工单列表", notes = "获取工单列表", code = 200, produces = "application/json", responseContainer = "List", response = Result.class)
    public Result getMenu() {
        log.info("/workorder/list");
        List<WorkOrderDomain> workOrderDomainList = workOrderService.getWorkOrder();

        result.setCode(0);
        result.setMsg(null);
        result.setSuccess(true);
        result.setData(workOrderDomainList);
        return result;
    }

}

